<template>
  <div class="login">
    <img :src="logo" alt="" class="logo" />
    <el-form :model="form" class="form" ref="form">
      <div class="text">
        <img :src="login_logo" alt="" /><span class="left">黑马面面</span
        ><span class="right">用户登陆</span>
      </div>
      <el-form-item prop="phone">
        <el-input
          v-model="form.phone"
          prefix-icon="el-icon-user"
          placeholder="请输入手机号"
        />
      </el-form-item>
      <el-form-item prop="password">
        <el-input
          v-model="form.password"
          prefix-icon="el-icon-lock"
          placeholder="请输入密码"
        />
      </el-form-item>
      <el-form-item prop="code">
        <div class="code">
          <el-input
            v-model="form.code"
            prefix-icon="el-icon-key"
            placeholder="请输入验证码"
          />
          <!-- <img :src="address" @click="getCode" /> -->
        </div>
      </el-form-item>
      <el-form-item prop="checked"
        ><el-checkbox v-model="form.checked"
          >我已阅读并同意 <a href="#">用户协议</a> 和
          <a href="#">隐私条款</a></el-checkbox
        ></el-form-item
      >
      <div style="margin-bottom: 25px">
        <el-button @click="login" type="primary" style="width: 100%"
          >登录</el-button
        >
      </div>
      <div>
        <el-button type="primary" style="width: 100%">注册</el-button>
      </div>
    </el-form>
  </div>
</template>

<script>
import logo from "@/assets/img/login_banner_ele.png";
import login_logo from "@/assets/img/login_logo.png";
export default {
  data() {
    return {
      logo,
      login_logo,
      address: "http://localhost:8080/api/captcha?type=login",
      form: {
        phone: "18511111111",
        password: "12345678",
        code: "",
      },
      checked: false,
    };
  },
  methods: {
    async login() {
      this.$router.push("/");
    },
  },
};
</script>

<style lang="less" scoped>
.login {
  // padding-top: 200px;
  position: relative;
  height: 100vh;
  background-image: linear-gradient(to bottom, #1493fa, #01c6fa);
  .logo {
    position: absolute;
    right: 180px;
    top: 250px;
  }
  .form {
    position: absolute;
    top: 180px;
    left: 150px;
    padding: 45px 40px;
    width: 400px;
    height: 500px;
    background-color: #f5f5f5;
    .text {
      font-size: 24px;
      line-height: 1.2;
      margin-bottom: 25px;
      .left {
        padding-right: 6px;
        margin-left: 10px;
        display: inline-block;
        border-right: solid 1px gray;
      }
      .right {
        padding-left: 6px;
      }
    }
    .code {
      display: flex;
      img {
        height: 40px;
      }
    }
    a {
      color: #1395fa;
      text-decoration: none;
    }
  }
}
</style>
